package com.sphd.emanu.adapter;

import android.content.Context;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.sphd.emanu.R;
import com.sphd.emanu.config.Constant;
import com.sphd.emanu.pojo.vip.MemDeposit;
import com.squareup.picasso.Picasso;
import com.wzutils.TimeUtils;

import java.util.List;

/**
 * @Author Hu
 * @Time 2017/4/24 --16:21.
 * @Email 87683202@qq.com
 */
public class TopUpTodaydapter extends BaseQuickAdapter<MemDeposit,BaseViewHolder>{
    Context context;
    public TopUpTodaydapter(int layoutResId, List<MemDeposit> data,Context context) {
        super(layoutResId, data);
        this.context=context;
    }

    @Override
    protected void convert(BaseViewHolder helper, MemDeposit item) {
        ImageView imageView=helper.getView(R.id.item_vip_img);
        setImageNet(imageView,item.getMemberAvatar());
        helper
                .setText(R.id.item_vip_name,item.getMemberName())
                .setText(R.id.item_vip_money,"￥"+item.getCreditFact())
                .setText(R.id.item_vip_content,"缴费"+item.getCreditFact()+"充值"+item.getCredit())
                .setText(R.id.item_vip_time, TimeUtils.dateToString(item.getEntryTime(),TimeUtils.YEAR_MONTH_DAY_HOUR_MIN_SS));

    }
    public void setImageNet(ImageView imageView, String url) {
        Picasso.with(context)
                .load(Constant.HTTPTITLE_Base + url)
                .placeholder(R.mipmap.ic_launcher)
                .error(R.mipmap.ic_launcher)
                .into(imageView);
    }
}
